package board;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.text.FlxText;
import flixel.util.FlxColor;

/**
 * ...
 * @author ...
 */
class Team extends FlxSprite
{
	var Color : Int;
	public var position : Int;
	public var multiplier:Int;
	public var score : Int;
	public var scoreText:FlxText;
	public var TeamNumber:Int;
	public var carcel:Int;
	var relativePosX: Int;
	var relativePosY: Int;
	
	public function new(teamColor:Int, teamNumber:Int,text:FlxText, score:Int, position:Int, fileName:String) 
	{
		super();
		carcel = 0;
		Color = teamColor;
		scale.set(0.1, 0.1);
		updateHitbox();
		centerOffsets();
		centerOrigin();
		offset.x = 220;
		offset.y = 430;
		x = 0;
		y = 0;
		this.position = position;
		this.score = score;
		scoreText = text;
		TeamNumber = teamNumber;
		loadGraphic(fileName);
		this.color = teamColor;
		multiplier = 1;
		
		relativePosX = (teamNumber % 2 == 0) ? 0 : 50; 
		relativePosY = (teamNumber < 2) ? 0 : 50;
		
		setPosition(TableroTestState.casilleros[position].xPos + relativePosX, 
					TableroTestState.casilleros[position].yPos + relativePosY);
	}
	
	public function addScore(value:Int):Void
	{
		this.score += value;
		if (score < 0)
			score = 0;
		scoreText.text = Std.string(this.score);
	}
}